package com.hengdu.cms.workquene;

import java.io.IOException;

import com.hengdu.cms.util.RabbitMQUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class Provider {

	public static void main(String[] args) throws IOException {

		Connection connection = RabbitMQUtils.getConnection();

		// 获取通道
		Channel channel = connection.createChannel();

		// 通过通道声明队列
		channel.queueDeclare("work", true, false, false, null);

		for (int i = 0; i < 20; i++) {

			// 生成消息
			channel.basicPublish("", "work", null, ("秋风瑟瑟,寒风萧萧~~~" + i).getBytes());
		}

		RabbitMQUtils.closeConnectionAndChanel(channel, connection);
	}

}
